#ifndef INVOICESMODEL_H
#define INVOICESMODEL_H

#include "Invoice.h"

#include <QStandardItemModel>

class InvoicesModel : public QStandardItemModel
 {
     Q_OBJECT

 public:

    static const int s_columns;

    enum COLUMN
    {
        INVOICE_ID                   = 0,
        INVOICE_DATE                 = 1,
        INVOICE_CUSTOMER_NAME        = 2,
        INVOICE_PRODUCT_NAMES        = 3,
        INVOICE_TOTAL_TAXES          = 4,
        INVOICE_TOTAL_WITHOUT_TAX    = 5,
        INVOICE_TOTAL_PROFIT         = 6,
        INVOICE_TOTAL_PRICE          = 7
    };

    InvoicesModel( const std::vector< ecocity::Invoice >& invoices,
                   QObject *parent = 0 );

    void reset( const std::vector< ecocity::Invoice >& invoices );

    bool add_invoice( const ecocity::Invoice& invoice );

    QVariant headerData( int section, Qt::Orientation orientation, int role ) const;

    Qt::ItemFlags flags( const QModelIndex & index ) const;

    void save( const QString& file_name ) const;
    //bool load( const QString& file_name );

    int get_biggest_id( );
 };


#endif // INVOICESMODEL_H
